﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace WebDesign.terms
{
    public partial class enrollment : System.Web.UI.Page
    {
        SqlClass sc = new SqlClass();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
        {
            
            SqlCommand cm = new SqlCommand();
            cm.Parameters.AddWithValue("@Aname",txtname.Text);
            cm.Parameters.AddWithValue("@Afamily", txtfamily.Text);
            cm.Parameters.AddWithValue("@Afather", txtfathername.Text);
            cm.Parameters.AddWithValue("@Aidnum", txtidnum.Text);
            cm.Parameters.AddWithValue("@Anumn", txtnatinalnum.Text);
            cm.Parameters.AddWithValue("@Acity", txtcity.Text);
            cm.Parameters.AddWithValue("@Amobile", txtmobile.Text);
            cm.Parameters.AddWithValue("@Aphone", txtphone.Text);
            cm.Parameters.AddWithValue("@Aemail", txtemail.Text);
            cm.Parameters.AddWithValue("@Aadd", txtaddress.Text);
            cm.Parameters.AddWithValue("@Aedu", txtlevel.Text);
            cm.Parameters.AddWithValue("@Afeild", txtfeild.Text);
            cm.Parameters.AddWithValue("@Areag", txtreagent.Text);
            sc.UseStoredProcedure("ApplicantSave", cm);
           /* SqlCommand cmd=new SqlCommand();
            sc.UseStoredProcedure("SelectApplicantId", cmd);
           Int32 count = Int32.Parse(cm.Parameters["@Aid"].Value.ToString());*/
            string count = sc.checkCommand("select max(ApplicantId) from Applicanttbl");
          // sc.Command("insert into Enrollmenttbl values");
           SqlCommand sm = new SqlCommand();
           
           sm.Parameters.AddWithValue("@termid", txtTermid.Text);
           sm.Parameters.AddWithValue("@aid", count);
           sm.Parameters.AddWithValue("@edate", System.DateTime.Now.Date.ToString());
           sc.UseStoredProcedure("EnrollmentSave",sm);
        }
    }
}